home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 30 / PC Gamer IT CD 30 1-2.iso / MOTS / GAMEDATA / RESOURCE / JKMRES.GOO / cog_item_irgoggles.cog < prev    next >
Text File  |  1998-02-25  |  3KB  |  104 lines

  1. # Jedi Knight Cog Script
  2. #
  3. # ITEM_IRGOGGLES.COG
  4. #
  5. # INVENTORY SCRIPT - IR Goggles
  6. #
  7. # [CYW & YB]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10.  
  11.  
  12. symbols
  13.  
  14. thing       player
  15. int         effectHandle=-1
  16.  
  17. message     activated
  18. message     pulse
  19. message     killed
  20.  
  21. sound       goggleActivate=activate01.wav
  22. sound       goggleDeactivate=deactivate03.wav
  23.  
  24. end
  25.  
  26. # ========================================================================================
  27.  
  28. code
  29.  
  30. activated:
  31.    player = GetSourceRef();
  32.  
  33.    if(GetInv(player, 41))
  34.    {
  35.       if(IsInvActivated(player, 41) == 0)
  36.       {
  37.          if(GetInv(player, 13) > 0)
  38.          {
  39.             // Print("IR Goggles ON");
  40.             jkPrintUNIString(player, 254);
  41.             SetInvActivated(player, 41, 1);
  42.             PlaySoundThing(goggleActivate, player, 1.0, -1, -1, 0x80);
  43.             effectHandle = newColorEffect(0, 1, 0, 0, 0, 0, 0, 0, 0, 1.0);
  44.             EnableIRMode(0.3, 1);
  45.             SetPulse(1.5);
  46.          }
  47.          else
  48.          {
  49.             // Print("IR Goggles Out Of Power");
  50.             jkPrintUNIString(player, 256);
  51.             PlaySoundThing(goggleDeactivate, player, 1.0, -1, -1, 0x80);
  52.          }
  53.       }
  54.       else
  55.       {
  56.          // Print("IR Goggles OFF");
  57.          jkPrintUNIString(player, 255);
  58.          SetInvActivated(player, 41, 0);
  59.          if(!IsInvActivated(player, 23)) DisableIRMode();
  60.          PlaySoundThing(goggleDeactivate, player, 1.0, -1, -1, 0x80);
  61.          if(effectHandle!=-1) freeColorEffect(effectHandle);
  62.          SetPulse(0);
  63.       }
  64.    }
  65.  
  66.    Return;
  67.  
  68. # ........................................................................................
  69.  
  70. pulse:
  71.    ChangeInv(player, 13, -5);
  72.    if(GetInv(player, 13) == 0)
  73.    {
  74.       // Print("IR Goggles Out Of Power");
  75.       jkPrintUNIString(player, 256);
  76.       SetInvActivated(player, 41, 0);
  77.       PlaySoundThing(goggleDeactivate, player, 1.0, -1, -1, 0x80);
  78.       if(!IsInvActivated(player, 23)) DisableIRMode();
  79.       if(effectHandle!=-1)
  80.          freeColorEffect(effectHandle);
  81.       SetPulse(0);
  82.    }
  83.  
  84.    Return;
  85.  
  86. # ........................................................................................
  87.  
  88. killed:
  89.    player = GetLocalPlayerThing();
  90.    if(GetSenderRef() != player) Return;
  91.  
  92.    if(IsInvActivated(player, 41) == 1)
  93.    {
  94.       SetPulse(0);
  95.       SetInvActivated(player, 41, 0);
  96.       DisableIRMode();
  97.       if(effectHandle!=-1) freeColorEffect(effectHandle);
  98.    }
  99.    Return;
  100.  
  101. end
  102.  
  103.  
  104.